# -*- coding: utf-8 -*-

# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html

import scrapy
from peewee import *
from judgement.settings import MYSQL_CONF

db = MySQLDatabase(MYSQL_CONF['database'], 
                   host = MYSQL_CONF['host'], 
                   user = MYSQL_CONF['user'], 
                   passwd = MYSQL_CONF['password'])

class BaseModel(Model):

    class Meta:
        database = db


class JudgementDbItem(BaseModel):

    name = CharField(null = True)
    type = CharField(null = True)
    name = CharField(null = True)
    court = CharField(null = True)
    date = DateTimeField(null = True)
    url = CharField(null = True)
    docid = CharField(null = True)
    produce = CharField(null = True)
    gist = CharField(null = True)
    content = TextField(null = True)


class JudgementItem(scrapy.Item):
    # define the fields for your item here like:
    name = scrapy.Field()
    type = scrapy.Field()
    num = scrapy.Field()
    court = scrapy.Field()
    date = scrapy.Field()
    url = scrapy.Field()
    docid = scrapy.Field()
    produce = scrapy.Field()
    gist = scrapy.Field()
    content = scrapy.Field()  


